package com.ruoyi.service.impl;

import com.ruoyi.domain.Banner;
import com.ruoyi.mapper.BannerMapper;
import com.ruoyi.platform.service.impl.BaseServiceImpl;
import com.ruoyi.service.IBannerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * 轮播图Service业务层处理
 *
 * @author tp
 * @date 2022-11-01
 */
@Service
public class BannerServiceImpl extends BaseServiceImpl<BannerMapper,Banner> implements IBannerService
{

    @Autowired
    private BannerMapper bannerMapper;

    /**
     * 查询轮播图
     *
     * @param id 轮播图主键
     * @return 轮播图
     */
    @Override
    public Banner selectBannerById(Integer id)
    {
        return bannerMapper.selectBannerById(id);
    }

    /**
     * 查询轮播图列表
     *
     * @param banner 轮播图
     * @return 轮播图
     */
    @Override
    public List<Banner> selectBannerList(Banner banner)
    {
        return bannerMapper.selectBannerList(banner);
    }

    /**
     * 新增轮播图
     *
     * @param banner 轮播图
     * @return 结果
     */
    @Transactional
    @Override
    public int insertBanner(Banner banner)
    {
            return bannerMapper.insert(banner);
    }

    /**
     * 修改轮播图
     *
     * @param banner 轮播图
     * @return 结果
     */
    @Transactional
    @Override
    public int updateBanner(Banner banner)
    {
        return bannerMapper.updateById(banner);
    }

    /**
     * 批量删除轮播图
     *
     * @param ids 需要删除的轮播图主键
     * @return 结果
     */
    @Transactional
    @Override
    public int deleteBannerByIds(Integer[] ids)
    {
        return bannerMapper.deleteBannerByIds(ids);
    }

    /**
     * 删除轮播图信息
     *
     * @param id 轮播图主键
     * @return 结果
     */
    @Transactional
    @Override
    public int deleteBannerById(Integer id)
    {
        return bannerMapper.deleteBannerById(id);
    }

}
